// Rozszerzanie zestawu zmiennych egzemplarzowych

#import <Foundation/Foundation.h>

// Deklaracja i definicja klasy ClassA

@interface ClassA: NSObject
{
    int  x;
}

-(void) initVar;
@end

@implementation ClassA
-(void) initVar
{
    x = 100;
}
@end

// Deklaracja i definicja klasy ClassB

@interface ClassB: ClassA
{
    int  y;
}
-(void)  initVar;
-(void)  printVar;
@end

@implementation ClassB
-(void) initVar
{
    x = 200;
    y = 300;
}

-(void) printVar
{
    NSLog (@"x = %i", x);
    NSLog (@"y = %i", y);
}
@end

int main (int argc, char *argv[])
{
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

    ClassB *b = [[ClassB alloc] init];

    [b initVar];  // Uycie przesaniajcej metody z klasy ClassB
    [b printVar];  // Wywietla wartoci x i y;

    [b release];
    [pool drain];
    return 0;
}